import { StateCreator } from "zustand";
import { StoreState } from ".";

export interface FishSlice {
  fishes: number;
  addFish: () => void;
}

type CreateFishSlice = StateCreator<StoreState, [], [], FishSlice>;

export const initialFishState = {
  fishes: 0,
};

export const createFishSlice: CreateFishSlice = (set) => {
  return {
    ...initialFishState,
    addFish: () => set((state) => ({ fishes: state.fishes + 1 })),
  };
};
